package com.example.myapplication.lol.ui;

import android.os.Bundle;
import android.view.View;
import androidx.viewpager.widget.ViewPager;

import com.example.myapplication.R;
import com.example.myapplication.lol.adapter.VpFragmentAdapter;
import com.example.myapplication.lol.base.BaseFragment;
import com.example.myapplication.lol.bean.TabBean;
import com.google.android.material.tabs.TabLayout;


public class FragmentLol1 extends BaseFragment {
    public static Bundle newArgument(String title) {
        Bundle args = new Bundle();
        args.putString("title", title);
        return args;
    }

    private TabLayout mTabLayout;
    private ViewPager mViewPager;
    private VpFragmentAdapter mvpFragmentAdapter;

    @Override
    protected int rootLayout() {
        return R.layout.fragment_lol_1;
    }

    @Override
    protected void initView(View view) {
        mTabLayout = view.findViewById(R.id.lol_tab_menu);
        mViewPager = view.findViewById(R.id.lol_viewpager_content);
    }

    @Override
    protected void initData() {
        mvpFragmentAdapter = new VpFragmentAdapter(getChildFragmentManager());
        mTabLayout.setupWithViewPager(mViewPager);
        mTabLayout.setInlineLabel(true);
        mViewPager.setAdapter(mvpFragmentAdapter);
    }

    @Override
    protected void bindData() {
        super.bindData();
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"关注"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"推荐"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"赛事"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"云顶"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"手游"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"视频"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"电视台"));
        mvpFragmentAdapter.addData(new TabBean(TabBean.TYPE_ARTICLE,"活动"));
    }

    @Override
    protected void bindEvent() {}
}